unit estoque;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, ImgList, ComCtrls;

type
  TFormEstoque = class(TForm)
    ListView2: TListView;
    ActTotal: TActionList;
    ActionVoltar: TAction;
    ImageList1: TImageList;
    ActionItens: TAction;
    ActionUnidades: TAction;
    ActionLancamento: TAction;
    ActionFornecedor: TAction;
    ActionInventario: TAction;
    ActionEstoque: TAction;
    ActionLancaInventario: TAction;
    procedure FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ListView2Click(Sender: TObject);
    procedure ActionVoltarExecute(Sender: TObject);
    procedure ActionItensExecute(Sender: TObject);
    procedure ActionUnidadesExecute(Sender: TObject);
    procedure ActionLancamentoExecute(Sender: TObject);
    procedure ActionFornecedorExecute(Sender: TObject);
    procedure ActionInventarioExecute(Sender: TObject);
    procedure ActionEstoqueExecute(Sender: TObject);
    procedure ActionLancaInventarioExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormEstoque: TFormEstoque;

implementation

uses ingrediente, unidades, IngredProdutos, LancaEstoque, ProdIngrediente,
  fornecedores, ExecicioInventario, Inventario, PosicaoEstoque,
  IInventario;

{$R *.dfm}

procedure TFormEstoque.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

  if Key = VK_ESCAPE then
     self.close;
end;

procedure TFormEstoque.ListView2Click(Sender: TObject);
var List: TListView;
begin
if TListView(Sender).Selected <> nil then
  begin
        List := TlistView(Sender);
        ActTotal.Actions[List.Selected.StateIndex].Execute;
  end;
end;

procedure TFormEstoque.ActionVoltarExecute(Sender: TObject);
begin

close;
end;

procedure TFormEstoque.ActionItensExecute(Sender: TObject);
begin
   if assigned(FormIngrediente) then
       FormIngrediente := nil;
    FormIngrediente := TFormIngrediente.Create(Self);
    FormIngrediente.ShowModal;
end;

procedure TFormEstoque.ActionUnidadesExecute(Sender: TObject);
begin
    if assigned(FormUnidades) then
       FormUnidades := nil;
    FormUnidades := TFormUnidades.Create(Self);
    FormUnidades.ShowModal;
end;

procedure TFormEstoque.ActionLancamentoExecute(Sender: TObject);
begin
    if assigned(FormInventario) then
       FormInventario := nil;
    FormInventario := TFormInventario.Create(Self);
    FormInventario.ShowModal;
end;

procedure TFormEstoque.ActionFornecedorExecute(Sender: TObject);
begin
    if assigned(FormFornecedores) then
       FormFornecedores := nil;
    FormFornecedores := TFormFornecedores.Create(Self);
    FormFornecedores.ShowModal;
end;

procedure TFormEstoque.ActionInventarioExecute(Sender: TObject);
begin
    if assigned(FormExercicioInventario) then
       FormExercicioInventario := nil;
    FormExercicioInventario := TFormExercicioInventario.Create(Self);
    FormExercicioInventario.ShowModal;
end;

procedure TFormEstoque.ActionEstoqueExecute(Sender: TObject);
begin
  if assigned(FormPosicaoEstoque) then
       FormPosicaoEstoque := nil;
    FormPosicaoEstoque := TFormPosicaoEstoque.Create(Self);
    FormPosicaoEstoque.ShowModal;
end;

procedure TFormEstoque.ActionLancaInventarioExecute(Sender: TObject);
begin
  if assigned(FormIInventario) then
       FormIInventario := nil;
    FormIInventario := TFormIInventario.Create(Self);
    FormIInventario.ShowModal;
end;

end.
